<ion-header>
  <ion-toolbar>
    <ion-buttons slot="start">
      <ion-back-button [defaultHref]="'/services/' + pkgId"></ion-back-button>
    </ion-buttons>
    <ion-title>Actions</ion-title>
  </ion-toolbar>
</ion-header>

<ion-content class="ion-padding-top with-widgets">
  <ion-item-group *ngIf="pkg$ | async as pkg">
    <!-- ** standard actions ** -->
    <ion-item-divider>Standard Actions</ion-item-divider>
    <app-actions-item
      [action]="{
        name: 'Uninstall',
        description: 'This will uninstall the service from StartOS and delete all data permanently.',
        icon: 'trash-outline'
      }"
      (click)="tryUninstall(pkg)"
    ></app-actions-item>

    <!-- ** specific actions ** -->
    <ion-item-divider *ngIf="!(pkg.manifest.actions | empty)">
      Actions for {{ pkg.manifest.title }}
    </ion-item-divider>
    <app-actions-item
      *ngFor="let action of pkg.manifest.actions | keyvalue: asIsOrder"
      [action]="{
        name: action.value.name,
        description: action.value.description,
        icon: 'play-circle-outline'
      }"
      (click)="handleAction(pkg, action)"
    ></app-actions-item>
  </ion-item-group>
</ion-content>
